#!/bin/sh

workdir=~/workshop/gitee/3place/781fortuneEN

today=`date  |awk '{for (counter=1;counter<(NF-2);counter++) printf $counter;print ""}'`

cd $workdir

ls *$today* >/dev/null 2>/dev/null 

if [ $? -eq 0 ]; then
	cat *$today*
	exit
fi


number=`ls FOR*.md |wc |awk '{print $1}'`

if [ $? -ne 0 ]; then
	number=1
fi

((nunmber=number+1))

strnumber=`printf "FOR%03d_" $number`

todayfile=$strnumber$today.md

fortune |awk '{print $0 "\n"}'  > $todayfile

cat $todayfile